class Solution:
    def findMin(self, nums) -> int:
        if len(nums) == 0:
            return None
        start = 0
        end = len(nums) - 1
        if nums[start] < nums[end]:
            return nums[start]
        while True:
            middle = (start + end) // 2
            if middle == start:
                return min(nums[start], nums[end])
            if nums[start] > nums[middle]:
                start, end = start, middle
            else:
                start, end = middle, end

if __name__ == '__main__':
    so = Solution()
    s = [1,2,3]
    r = so.findMin(s)
    print(r)
